#include "GetFiles.h"

GetFiles::GetFiles(QString dir,ResultCollector *result,QObject *parent)
 : QThread(parent)
{
	this->dir = dir;
this->result =result;
	connect(this,SIGNAL(signalResult(QStringList)),result,SLOT(storeResult(QStringList)));
}


GetFiles::~GetFiles()
{

}


void GetFiles::run()
{
	QStringList names;
	QDir directory ( dir );

	QStringList filter;

	filter << "*.jpg" << "*.png" << "*.bmp" << "*.gif" << "*.jpeg" << "*.pbm" << "*.xmp" << "*.xbm";
	//filter << "*2008*" ;
	//qDebug() <<startDir;
	foreach ( QString file, directory.entryList ( filter, QDir::Files ) )
	names += dir + "/" + file;
	
	if(names.count() > 0)
	{
		//qDebug() << names;
		//emit signalResult(names);
		result->storeResult(names);
	}

	wait(20000);
}
